<template>
  <a-modal :width="width" title="客户列表" :visible="checkVisible" @ok="" @cancel="checkVisible = false" :footer="null">
    <a-table
      v-if="customerList.length > 0"
      style="margin-top: 15px; border: 1px solid #ebeef5"
      :pagination="ipagination"
      :columns="columns"
      :data-source="customerList"
      @change="handleTableChange"
    >
    </a-table>
  </a-modal>
</template>

<script>
import { httpAction, getAction } from '@/api/manage'

import { mixinDevice } from '@/utils/mixin'
export default {
  name: 'customerList',
  props: {},
  components: {},
  data() {
    return {
      queryParam: {
        customerName:''
      },
      ipagination: {
        current: 1,
        pageSize: 50,
        showTotal: (total, range) => {
          return range[0] + '-' + range[1] + ' 共' + total + '条'
        },
        total: 0,
      },
      columns: [
        {
          title: '客户经理',
          width: 60,
          ellipsis: true,
          align: 'center',
          dataIndex: 'ownerUserId_dictText',
        },
        {
          title: 'BU',
          width: 60,
          ellipsis: true,
          align: 'center',

          dataIndex: 'ownerUserId_bu',
        },
        {
          title: '客户名称',
          width: 120,
          ellipsis: true,
          align: 'center',
          dataIndex: 'customerName',
          scopedSlots: { customRender: 'customerName' },
        },
        {
          title: '创建时间',
          width: 100,
          ellipsis: true,
          align: 'center',
          dataIndex: 'createTime',
        },
      ],
      customerList: [],
      width: 1000,
      checkVisible: false,
      url: {
        list: '/online/api/pagingCrmCustomer',
      },
    }
  },
  created() {},
  methods: {
    show(data) {
      // this.queryParam.customerName = id
      this.customerList = data
      this.checkVisible = true
    },
    loadData(id) {
      let param = {}
      param.customerName = this.queryParam.customerName
      param.pageNo = this.ipagination.current
      param.pageSize = this.ipagination.pageSize
      param.ownerUserId_op  = 'notEqual'
      param.ownerUserId  = 'public'
      httpAction(this.url.list, param, 'post').then((res) => {
        if (res.success) {
          this.customerList = res.result.records || []
          this.ipagination.total = res.result.total
        }
      })
    },
    handleTableChange(pagination, filters, sorter) {
      //分页、排序、筛选变化时触发
      //TODO 筛选
      if (Object.keys(sorter).length > 0) {
        this.isorter.column = sorter.field
        this.isorter.order = 'ascend' == sorter.order ? 'asc' : 'desc'
      }
      this.ipagination = pagination
      // this.loadData()
    },
  },
}
</script>

<style lang="less" scoped>
/deep/ .ant-input {
  border-radius: 0;
}
/deep/ .ant-select {
  width: 100%;
}
/deep/ .ant-select-selection {
  border-radius: 0;
}
/deep/ .ant-modal-header {
  border-bottom: 1px solid #e8e8e8;
}
/deep/ .ant-table-thead > tr > th,
.ant-table-tbody > tr > td {
  padding: 10px 15px;
}
/deep/ .ant-modal-mask {
  z-index: 96 !important;
}
/deep/ .ant-modal-wrap {
  z-index: 96 !important;
}
</style>